home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / init.d / umountroot < prev    next >
Text File  |  2008-10-14  |  1KB  |  58 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          umountroot
  4. # Required-Start:
  5. # Required-Stop:
  6. # Should-Stop:       halt reboot kexec
  7. # Default-Start:
  8. # Default-Stop:      0 6
  9. # Short-Description: Mount the root filesystem read-only.
  10. ### END INIT INFO
  11.  
  12. PATH=/sbin:/bin
  13. . /lib/init/vars.sh
  14.  
  15. . /lib/lsb/init-functions
  16.  
  17. do_stop () {
  18.     [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only"
  19.     # These directories must exist on the root filesystem as they are
  20.     # targets for system mountpoints.  We've just unmounted all other
  21.     # filesystems, so either they are mounted now (in which case the
  22.     # mount point exists) or we can make the mountpoint.
  23.     for dir in /proc /sys /var/run /var/lock; do
  24.         mkdir -p $dir || true
  25.     done
  26.  
  27.     MOUNT_FORCE_OPT=
  28.     [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
  29.     # This:
  30.     #     mount -n -o remount,ro /
  31.     # will act on a bind mount of / if there is one.
  32.     # See #339023 and the comment in checkroot.sh
  33.     mount    $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev / 2>/dev/null \
  34.     || mount $MOUNT_FORCE_OPT -n -o remount,ro              dummydev / 2>/dev/null \
  35.     || mount $MOUNT_FORCE_OPT -n -o remount,ro                       /
  36.     ES=$?
  37.     [ "$VERBOSE" = no ] || log_action_end_msg $ES
  38. }
  39.  
  40. case "$1" in
  41.   start)
  42.     # No-op
  43.     ;;
  44.   restart|reload|force-reload)
  45.     echo "Error: argument '$1' not supported" >&2
  46.     exit 3
  47.     ;;
  48.   stop)
  49.     do_stop
  50.     ;;
  51.   *)
  52.     echo "Usage: $0 start|stop" >&2
  53.     exit 3
  54.     ;;
  55. esac
  56.  
  57. :
  58.